package com.example.demo04datamybatis.controller;

import com.example.demo04datamybatis.mapper.EmployeeMapper;
import com.example.demo04datamybatis.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmpController {

    @Autowired
    private EmployeeMapper employeeMapper;


    @RequestMapping(path = "/emp/{id}")
    public Employee getEmp(@PathVariable Integer id) {
        Employee emp = employeeMapper.getEmpById(id);
        return emp;
    }
}
